Skip to main content

Full text of "dg :: fhp :: 19771020 Memo312 COBOL S-Language"

See other formats

+4444 4444444444444444444444444444444444444444444444444444444444444444 44444 44444+ 

i $ j>S^>S 

i S i> & 


i> $ a) b 

& 35 03 vD 

$ i $ $4 4 

$4$ 4 $ 4 4S4S 

I)£>Ek = jJu QuEuE=LkT DE V I CE=SLPii 1 
SEQ = b OPR I = 12/ LPP = 65 CPL = 8u CuPIE3=l L.iMiT = 4v 

CkEaTcO; 20-OCW7 l5:4b:^4 

tNuUtUtD; o-uFu-77 l4:?i:o6 
pPINIIimG: o-uEl- 77 1 4 : 3 i : U4 

PA |H=:pDUIMEi v lO:Mfc.MU$4lc!.LS 



$ & $ 3> $ 












sb $ 

$ $ 

S vD S & 



$ $ 


$ & 



3> 4> 


S $ 

& & 


4 4 




3> 3> 



4) $ 


$ <5 

$ i* 





5 $S> 





$ % 

& & 











$ $ 


$ $ 



4> $ 


4) 4? 







4 $ 4 $ a> 



* * S * S 


+444444444444444444444444444444^4444 4444444444 44 "a444444444444444<+«4« +444444444+ 




From: John Pilat, Michael Richmond 

Subject: CuRuL S-Languaae, 1977 

Date: BU/Uct//7 Memo No. 3i? 

Aost ract : 

This memo describes the CuBOL S-Language. it supports J.9M o7u and 
Eclipse CUBuL data types, as well as the ANbI CUBuL standard. 

1 Data Types 

the data types supported by this COdOL s-languaae include 
those mandated oy the ANSI (ly74) standard, as well as those 
extensions offered oy ItiM 370 and the ECLlPSt., FxcePt for some 
minor storage allocation differences, tne extensions offered by 
both of these potential "market targets" are identical. bhould it 
become desirable (or necessary because of time constraints) this 
s-languaae can De striDpea of support for these extensions, witnout 
effect on the A w S i core, Dy deleting most instructions contain ina 
the word "RiNaRY" and all instructions containina the word 
"FluATlNG" . 

1.1 Data Type Considerations Masked by the compiler 

Some aspects of uOoOL "typeness" will oe removed by the CuBuL 
compiler, and will be realized with explicit instructions or 
through storage allocation policy. These include: 

a) Source operations requiring scaling or decimal Point 

alignment. Ihe compiler will generate exnlicit instructions 
to alian or scale operands. 

b) The determination of radix ana the concornmitant neeo for 

convers i on (s ) in operations. while tnis does have the 

effect of proliferating the number of instructions, it 
allows the IBM/ECLlPSt extensions to be separated easily 
from the remaining instructions and does not require a slow 
secondary decode for programs which use only ANbI stanuard 
t ypes . 

c) The need for editing, if any. The compiler will generate 

explicit edit instructions. 

Memo no. 3l2 
£0/ Oct/7 7 
page 2 

d) Synchronization and alignment. these are matters of 
storage allocation policy. 

1.2 Non-numeric Data 

1.2.1 ASCII as the NATIVE Character Set 

This CUBuL s-language supports A 5 CII as the NATiVt character 
set. Character translation instructions are included to deal with 
the alternate character set features of CUBUL. 

1.2.2 EBCDIC 

Support of EBCDIC may oe required at all levels of commercial 
software. The levei of support required is something that must be 
decided at the product planning level before EBCDIC support (oeyond 
the normal translation instructions) can be defined for a CuBUL 
s-1 anguage. 

1.3 Numeric Data 

CObOl defines a data item to be numeric if its picture con- 
sists only of the characters 9 # S # V # and P . Numeric data items 
may be combined freely in arithmetic statements. A distinction is 
made between data representations which must oe in standard format 
(USAGt IS DISPLAY) ano those which may be in i mo ] e mentor-defined 
formats (USAGt IS COMpU 1 A HONaL ) . 


All non-numeric data is USAGE iS DISPLAY. Numeric data can 
also be of this form# which requires that the internal reoresenta- 
tion be character-oriented decimal digits. The programmer can 
control the existence and location of an operational sign within a 
numeric DiSPLAY item. In all cases# the soace character is a valid 
substitute for the character zero. 

Memo no. 3i? 
page 3 

1.3. 1.1 Unsi qned 

This representation is aenerated wren a data item is described 
by a picture whicn does not contain the operational sign designator 
S. The numeric value is represented as a string of tne characters 

1.3. 1.2 Separate o i g n Lead ina/Trai ling 

This is the standard interchange representation for signed 
data. 1 he sign is either ' + ' or and is tne first/last charac- 

ter position of the data fielu. I he digit values are as above? 

'0' . . '9' . 

1.3. 1.3 Overpunched Siqn Leadi ng/Trai I i no 

in this representation? the first/last character position of 
the data field implies both a digit and an operational sign. ihis 
encoding is a de facto standard. It is presented herewith along 
with the tRCOiC encoding for comparison. Note that an ASC I i /cBcD IC 
character translation on a character decimal field performs the 
correct mapping. 








EbCu I C 



unsi gned 

1 0 I 

7 R 




bO 1 


1 u0 

1 F u 

1 1 1 





31 1 


1 ol 

1 F 1 

1 2 1 





32 1 

C 2 

1 02 

1 F d 

1 3 1 





33 1 

C 3 

1 03 

! Fp 

1 A | 





34 1 

C 4 

1 04 

1 Fg 

1 5 1 





35 1 


1 05 

1 Fb 

1 6 1 





36 1 


1 06 

1 F 0 

1 7 1 





37 l 

C / 

i 07 

1 F, 

1 8 i 





S8 1 


1 08 

1 Fo 

1 9 i 





39 1 

C 9 

1 09 

1 F 9 

Call table 


i n hexadec i mal ) 


The COBOL standard requires no Particular representation for 
COMPUTATIONAL data. in the interest of ECLlPSt/IBH compatibility 

Memo no. 3l2 
2 O/Oct/7 / 
page 4 

we have made the bindings presented below. 


Ihese data items will be represented as signed, two's comple- 
ment binary inteqers, sized 8, 16, 24, 32, 40, 48, 36, anu o4 bits. 
The compiler will oenerate M AGwI|UoE instructions as needed to 
banal e unsigned binary aata (i.e., the interpreter need not worry 
about it). 


COMPoTaTI n ry A L — 1 data items will be 32 bit system floating 
point. COMPIJT A i I ONAL-2 data items will be o4 bit system floating 
point. Note that the interpreter must pe prepared to handle 
operations on mixes of the two precisions. 

1 .3.2.3 CUMPU T A T 1 0 N A L - 3 

COMPOTATI OoAL-3 aata items will be reoresented as packed 
dec i ma 1 . 

1.4 Name Table tntries 

The COdOL s-lanquage makes extensive use of namespace addres- 
sing features. All CuBOL subscripting ana indexing can be realized 
directly in the name table. IbM's extension which allows more than 
one dimension of an array to vary in size based on a run time value 
(which makes conversion of some IuM COdOl programs difficult on 
many systems) may also be realized directly. 

1.4.1 Starting Address ana Fetch direction 

All CObOL data will be addressed from the leftmost (i.e., low 
address) bit and be fetched to the right. ^hile it rrnqnt appear 
that numeric operands snould be addressed from the rightmost bit* 
this is not the case. First, the rightmost bit does not correspond 
to the low oraer digit (the address of start of the right most 
digit is seven less than the address of the rightmost bit). More 
importantly, an item addressed from the right would require another 
name table entry in order to be moved without regard to its type. 

i v 1emo no. 3 i 2 
page 5 

1.4.2 Length 

The length field in the name table contains an entity's bit 
length. The LObOL s-language uses entity length to distinguish 
between some source language data types. Single ana double preci- 
sion floating point (CUMPU I A TIuNAL-1 and CuMPUTAl I uNaL- 2 J are 
distinguished between each other by 32 or 64 in the length field. 
Size distinctions specified in a picture are also (obviously) 
reflected in the lenath field. 

1.4.3 Type 

The LOBOL s-language uses the name table type field to distin- 
guish among CuBuL's cornucopia of decimal data types. Note that of 
tnese seven types, only packed decimal is non-s t anda ru 1 The 
interpreter need only examine tne type field when an operand* is 
numeric decimal (something is numeric decimal if the opcooe says it 
is). The encoding of the four bit type field is as follows: 

0 U 0 0 : Packed decimal, unsigned. 
000 1 : Packed decimal, signed. 

0o 1 o : 


dec i ma 1 , 





decimal , 

s i gn 

i s 



1 eaoi ng. 



dec i ma 1 , 

s i gn 

i s 



t r a i 1 i ng . 



decimal , 

si gn 

i s 



1 eadi ng. 

01 lu: 


decimal , 

s i gn 

i s 




The decimal operations are defined to accept any of these decimal 
formats. Note that when the interpreter stores a sianeo value (be 
it decimal, floating or binary) into a decimal datum wnose type 
field indicates "unsigned", only the magnitude of the value is 

1.5 Instructions (100) 

|he notation used to describe instructions is as follows: 

Angle brackets < > enclose operands which are names. For 
example, <source> is the name (index into the name table) 

Memo no. 3i2 
20/Qct /I i 
page h 

of the source operand. 

Equal signs = = enclose operands which are literals 
offsets. For example, =pc = designates an offset from 
program counter. 



Memo no. 3i? 
page 7 

1.5.1 Moves ( 4 ) 

* MU\/E_CHaRaC I EKS <sou rc e> , <de s t i n a t i on > 

The lengths ot the operands as specified in the name table 
need not be equal. It the length of the source length 
exceeds the length of the destination* only "destination 
length" bits are moved. If the length of the destination 
is greater than the length of trie source, tne excess 
destination bits are filled with aScIi blank. isote that 
the lengths of the operands will always be some multiple of 

* MUVE_CHAPACTEkS_EuUAL <sou rce> , <des t i nat i on> 

Exactly " sou r ce_l engt h " bits are moved to the destination 
from the source. 

* MUVE_CHARAC TFkS_EDI I El) <source>, <dest i nat i on>, <pi cture> 

This instruction is described in terms of pointers to the 
source, destination and picture. These pointers are not 
Part of the macro state. One picture element exists for 
each eight bit character in the destination. |he picture 
is processed land its pointer bumped) in syncnrony with tne 
destination, tach pixel is eight bits. Its interpretation 
is as follows: 

OOOlnnnn: Iransfer "nnnn" characters from the 
source to the destination. Botn source and destin- 
ation pointers are bumped by "nnnn". If the source 
is exhausted, the source pointer is not bumpeu, and 
an ASCII blank is transferred. 

All others: The Pixel character is transferred to 
the destination anu the destination pointer is 
bumped oy one. 

Memo no. 3i? 
20/Oct /l 1 

page 8 

<scurce>,<destination>,<trans)ate table> 

The translate table is a string of e i gh t-o i t elements. 
This move behaves exactly like M0vE_CrlAKACTtR3 except that 
as each character is fetched from the source strina, it is 
usea as an index into the translate table. The contents of 
the translate table at the indexed location are transferred 
to the destination. Note tnat if blank padding is 
required^ the blank pad must be translated as well. 

Memo no. 3l2 
20/n c t/7/ 
page 9 

1.5.2 Conversions (15) 

* A3S1GN_DEC IdAi |0_BIMARY <sou rce> , <dest i nat i on> 

* ASSiGN_oEt IMAj iO_FLOATINp <sou rce> , <oest i nat i on> 

* A3SIGl\i_uFL I M A i iO__DtClMAL <source>»<destination> 

* ASS 1 GN_b I N A k Y_Tu_DEC I M Al <source>f <dest i nat i on> 

* ASSiGiSl_dI nAk Y_,Tu_FLU A TI imG <sou rce> , <des t i nat i on> 

* ASSiGN_bIi't!AKY_TU_Dli\iAr<Y < sou re e> t <des t i na t i on> 

* ASSiGrj_rLuAT lNG_TU_bIiMAKY <sou rce> , <des t i na t i on> 

* ASS 1 G is* L U A T I nG_T 0_DEC IMAL <source>,<dest mat jon> 

* ASSlGi^ELuAl ING_T0_r LuA | I nG <source>» <dest i nat i on> 

* A3SIGd_ MAbNiTUOE_bTNAHY < sou r c e> , <des t i na t i on> 

* DEC SC ALE_Lt p T =scale di f f = , <source> ( <dest i nat i on> 

Memo no. 3 12 
d 0/0ct/7/ 
page 10 

* DtClMAL_SLALE_RiGHT =scale aiff=r<source>r<destination> 

* RINARY_5CALt_UP_.BY_.10 =scale ai f f <source>r <uest i not i on> 

* B iNaR Y_5ChL t_D0^M_R Y_1 0 =scale ai ff=f<source>/<aestination> 

* DtCIMAt — RuUiyD =rounainp pos i t i on= , <sou rce> , <des t i nat i on> 

Memo no. 3i? 
page 11 

1.S.3 Numeric Eaitino Cl) 

Eun_WUMFRlL <source>» <tarpet> f <picture> 

The source is a decimal number which is edited into the 
target according to the oicture. The precise interpreta- 
tion of the picture is defineo oy an pPL procedure in tne 
apoenu i x . 

Memo no. 3i? 
20/0ct/7 i 
page 12 

1.5.4 Numeric Comparison branches (iOJ 

The numeric comparison branches compare two named 
values* or a single named value and zero* and hrancn to the 
indicated pc offset if the indicated comparison is true. 
The type of the sourceCs) and the comparison to oe per- 
formed is specified by each instruction's name. 

DEC 1M AL_C U m P AKE_EuU aL <sourcel>*<source2>* = pc = 

DECIMaL _CUMpAKE_NuT_EullAL <sourcel>*<sourceb>* = pc= 

DECIMAL _CuMp A KE_G HEATER <sou rc el>,< sou rce2>*=pe= 

DEC 1MaL._CuMP ARE_GHE ATER_OH_tQu Al <sourcel>,<source2>* =pc = 

BiNARY_.CDMPARt_t.QuAL <sourcel>*<source2>*=rc= 

Bi NAR Y_COi v iPARt_NO ) _EQO AL <source1>*<source?>*=Pc= 

B I N AR f _C0iMP ARt_uRt A |EH <sourcel>*<source2>*=oc = 

BiNARY_COMPARt_GRtAl Ek_uR_EuU AL <sourcel>,<source«t>*=pc = 

FLOAT INb_COMPARt_EQU AL <sourcet>*<source?>*=Pc= 

FLOAT iNb_LOMPARE_NOT_EQUAL <sourcel>*<source2>*=pc= 

Memo no. 3i2 
20/Oct /ll 

* FlOaT iNb_LOMPAPt_GREA FEK <sou rce 1 > t <sou rce?> > = pc = 

* FLnATlNb_COMPARt_tREArER_.uR_F.QUAL <sou rce 1 > , <sou rce2> r -pc. 

* DEC i M aI Zt.RU_TEbT_EuUAL <source>,=pc = 

* DtC IM aL._ZlRu_TE5T_NuT_EQUaL < sou rce> , = pc = 

* DEC I MAL_ZERU_TEi>T_GKE ATtR <souPce>/=Pc : 

* OLC 1MaL_ZERu_ I EoT_GkE ATER_O n_tOUAL <source>»=pc- 

* DtC iMAL_ZERU_TEoT_LtGo <source>? =pc= 

* DEC IMAL_ZtRU_i Fi>T_LES$_uR_EuUAL <source>r =pc = 

* BINaR Y_ tERO_TtS I _EQ uAl <sou rce> r =pc = 

* B1NAR Y_ZEHO_TtS i _i'jOT_tOuAt <source>,=pc = 

* B 1 N AR Y_ZERO_Tt S | _GRtA I Fk <source>» -p c - 

* B X N AR Y_ZEHO_Tt S I _GRE A T Ek_OP_EQUAL <source>» =pc = 

Memo no. 3i? 
page t <4 

B I N AP Y_ZEKO„_Tt S i _lE bS <sour'ce>f=pc = 

BIHaRY_ZFRO_TlS I - .LFShB_OR_c.QuAL <source>*=pc= 

FlOaT I Nb_ZFh0_T c. S I _t QU AL <source>» = pc= 

FLO ATi Nb_ZERO_Tt:S I .J^O T_tau Al <source>/=pc = 

F LOmTI NLj_ZEkO_T t S T_bRt A TEk <source>*=pc= 

FLHaT iNb_zFKO_T c S F _bRt A I Ek_uR_EuUaL <source>*=Pc = 

FLOAT J.Nb_ZEKO_TtS I _LEbS <source>f=Pc = 

FLOATINb_ZEKO_Tfc.S r„LESS_0R_„t QU A l <source>f =pc = 

the mo no. 3i2 
page lo 

l.S.S Mon-numeric Comparison branches (l2j 

Each non-numeric comparison executes a branch to the 
pc offset if its specified condition is true. Ihe compari- 
sons operate on eight bit characters in sequence from low 
to high aodress ( " 1 e f t - t o- r i qh t ) . Tne CH AP_CLA6S_Nu^tRIC 
and Ch AK_CLASS,_NO I'_NUMEKIC instructions also operate on 
oacKed 4-bit aigits (if indicated by the name table type 

When more than one source is specifier they need not oe 
tne same lenqth. When the sources are not the same length/ 
the snorter source should be treated as if it were extended 
on the right by the ASCII blank character. Tne two-source 
comparisons effectively Proceed by comparing characters in 
corresponainq character positions until eitner a pair of 
unequal characters is encountered/ or until the end is 
reached/ whichever comes first. fhe first pair of unequal 
characters encountered is useo to determine if the condi- 
tion specified by each instruction's name is true. The 
sources are considered eoual if all pairs of characters 
compare equally through the last pair. 

ChAK_COlhPARt._t.Qu AL <sourcel>/<source2>/=pc = 

Cri AR_C0MPARt_NP 1 _EQU Ai_ <sourcel>/<source?>/=pc = 

CHAK_C0MP APt_CRt A 1 E K <sourcel>/<source?>/=PC = 


This instruction Dehaves like CHAR_CCJMP ARE_GkF AT cR except 
that the sources are translated through "table" as they are 

ChAK_COMPARt_bRE A i EK_uR_EUUAL <sourcel>/<sourcec:>/=pc = 


Memo no. 3 1 2 
page lo 

This instruction behaves like CtlAK_.COMPARL_.bPt A 1 ER_uR_EuUaL 
except that the sources are translated throuqh "table" as 
they are compared. 

* CHAR_CLASi)_ALPHABLTIC < sou re e > , =pc = 

The condition is true if all the characters in the source 
are in the set of ApCII characters "A" thru " L" ana the 
blank. Mote that lower case letters are not in tne seti 

* CHAK_CLAS5_i'j01_Ml.PHrtBc.TiC <sou rce> , =pc = 

This instruction is the inverse of CH aP_Cu A dS_ALPilAfciE 1 I L . 

* CnAR_CL AS5 _NUmFR I C <sou r ce> t = pc = 

The condition is true if all the characters in <source> 
contain the dipits U through V and if tne sign is valid. 
The sign is considerea valid if its existence and position 
are as described by the name table type field. ivote that 

the source must be checked A bits at a time if tne name 
table type field for <source> indicates "packed”. 

* CHAR_CLaS3_ImO 1_NUMERIC <source>» =pc = 

Tnis instruction is tne inverse of LHMR_CLAoS_Nu M tRjlC . 

* CtlAR_3PACLS <sou rce > , =pc = 

The condition is true it all the characters in the source 
are equal to aSLIi blank. 

* CriAK_ixO r_bPACtS <source>, = pc = 

This instruction is the inverse of CHaR_SPACES 

Memo no. 3i? 

dO/Oc t /7 / 
page 1 / 

1.S.6 Arithmetics ( E A j 

the type ot the souecets j and des t i na t i on l s ) for an 
arithmetic instruction is specified by the first part of 
the instruction's name. The operation to be Performed is 
specified by the second part of the instruction's name. 

If no preposition follows the first two parts ot the 
instruction's name* then the operation uses two sources 
distinct from the dest i nat i on (,<s ) . if a preposition ooes 
follow the instruction's name, then tne secono operand is 
specified by <cest i nat i on* or <quotient>. 

For SURlRAC! instructions, the first source is the subtra- 
hend and the second source (wnich might also be tne 
destination} is the minuend. 

For DIVlDt instructions the first source is the divisor and 
the second source (which might also be the quotient} is the 
dividend. Note that DIVlDt instructions produce two 
results, a quotient and a remainder. 

DEC IMAL_AuD <sourcel>,<source2>,<uestination> 

DEC IMhI SUB FPaCT <.sourcel>,<source?>,<destination> 

DECiMAL_MULTIbLY <sourcel>,<source2>,<destination> 

DECIMAL _D IV IDE <sourcel>,<source2>,<cuotient>,<remainoer> 

DECIMAL _AuD_TU <source>,<aestination> 

DECIMAl — SUBTRAC f_FRuM <source>,<destination> 

DtCIMML_MULllPLY_6Y <source>,<destination> 

Memo no. 3i2 
page lb 

* DEC IMaL__DI VIDE_ iM I 0 <source>» <guot i ent>* <rema1 naer> 

* BINARY — A DU <sourcel>#<source2>r<destination> 

* BINAPY_SUtiTKACT < sou r c e 1 > , < sou re ed> , <aes t 1 n a t 1 on> 

* BINARY_MULT1PlY <sourcel>,<sourced>»<aest mat ion> 

* BiNARY_uI v IUE <sourcel>,<source£i>f<quotient>,<.remainder> 

* BINmR Y_AD u_i 0 <source>/ <dest i nat i on> 

* R 1NAP Y_SUbTKAcT_FKOM <source>/<destjnation> 

* BINaRY_J'1ULT IPlY_ 8 Y <source>, <dest i nat i on> 

* BINARY_Ul VIDE_lNTu <sou rc e > , <quo t l en t > f < rema i nde r> 

* FLO ATi Nl>_ADG <sou rce 1 > t <sou rce?> / <des t i na t i on> 

* FLOATlNG_i>UbTRACT <sourcei>f<sourcee!>/<destination> 

* FLOATiNG_MULTIPLY <sou rc e 1 > , <sou rc eL> , <des t i na t i on> 

Memo no. 3 jl? 
cfO / Oct/7/ 
page 1 9 

* Fl0aT1Nij„l) I V T DE <sou rce 1 > f <sou rced> t <quot i ent > , <rema i nde r> 

* FlOaT j.Nb_ADD_l 0 <source>»<destination> 

* FLOATlNG_i>UbTH ^CT_Fk0i*1 <s ou rc e> f <des t i n a t i on> 

* F l_ 0 A T i N G_M U l T I P l Y _R Y <source>,<dest i nat ion> 

* FL.OATi.MG_D I VlDE_TMu <sou rc e > , <quo t i en t > , < rema i nde r > 

Memo no. 3l? 
page ?U 

1.5.7 Size trror Handling (d) 

Many arithmetic and conversion operations can produce 
results which are too long to fit in the specified destina- 
tion (CuBUl lumps division by zero» overflow and underflow 
into this category). Explicit size error handling, when 
specified by the programmer, mandates tnat the destination 
field remain unchanged when a size error occurs. 

Ihe CObOL s-lanauaye therefore has two 1-bit size 
error flags which are part of process oata space. The 

first is called "UP_BaD". 0P_6aD is set to one by any 
operation which causes a size error. All operations except 
the conditional moves defined below are allowed to change 
the destination, even when a size error occurs. ror tnose 
instances where a size error is specified, the compiler 
will allocate a temporary as the destination, generating a 
checked assignment after the operation. The second size 
error flag is called "SIMJ^bAu". It is set to one it any 
operation in a statement incurs a size error. uP_BaD is 
always designated by name 0. S|K>r_bAu is always designated 
by name 1 . 


This operation sets Op^tiAu ana STpIT„_8aD to zero. 

* ChECKED__AdSiBI\!_uEC IMAl_I Q_DtC IP’AL <source>, <dest i nat i on> 

The action of this operation depends on the setting of 

0P_dAD = 1. STmT_BAD is set to 1. 0P_t>Au is set 
to 0. 

0P__bAb = 0. if the source fits in the destination, 
then the source is assigned to the destination, as 
in the unchecked aSSI GN_DtC j,MaL_TU_UEC IMAl . if the 
source does not fit in the destination, SfM|_bAu is 
set to 1. Note that the condition "fits in the 
destination" may depend on the number of signifi- 
cant decimal digits in the source, and not just its 
1 engt h ! 


<source>,<! imi t>,<destination> 

Memo no. 
dO/Oct/7 / 
page 2 i 

The action of this operation depends on the setting of 

0P_dAU = 1. STMT.BAD is set to 1. 0P_bAu is set 
to 0. 

0P_dAu = 0. If tne source fits in the destination, 
then the source is assigned to the destination, as 
in the unchecned ASSIbN_B i.NrtRY_Tn > _B.[HA D Y . If tne 
source ooes not fit in the destination, SlM'i_oAu is 
set to 1. ihe condition "fits in tne destination" 
is true if the magnitude of "source" does not 
exceed "limit". 

CHECKED _A SSiG[\i_FLUAT ! n G_TU._F10ATI hi G <source>, <dest i nat i on> 

The action of this operation depends on the setting of 
0P_b AD : 

0P_bAL> = 1. 3 TmT_BhD is set to 1. 0P__bAu is set 
to 0 . 

0P_dAu = U. An AoSiG.\i_PLuATlNG_Tu_PLuA | Ji\iG is 

I F_N0_S I Zt_bRkOK =pc = 

If STMT_BAD is 0, a branch to tne pc offset is taken. 

Memo no. 31? 
page ?.d 

1.5.8 String instructions (i) 

ihe following instructions support the LOcOu S|RiNp, 
UNSfRiNu and INbPtCI statements. In all these 
instructions^ <source> and <dest i nat i on> name Character 
(i.e. length is a multiple of eiaht) data. The data named 
by <start>,<end> and <index> are binary integers which 
"index" either the source or the destination. fhe value 
one designates the first character position, two the 
second, etc. Li.e. the strings are entity indexed). 

a MUV£_STRInG <sou rce> , <st a r t > , <end>, <des t i nat i on> , =pc= 

The characters in "source" from "start" through "end" are 
moved to "destination". if the numoer of characters to oe 
moved exceeds the space available in "destination", trunca- 
tion takes place, and a branch to the pc offset is 

* MUVt_TO_SrPINb <source>, <uest 1 nat i on> , <s t a r t > , <eno> , =pc= 

All the characters in "source" are movea to that portion of 
"destination" bounded by "start" through "end". If the 
numoer of characters to be moved exceeds the space in the 
delimited destination, truncation takes place and a Drench 
to the pc offset is executed. 

* SCAN_bTK ING <source>,<start>,<end>,<index>,<del imi ter>,=pc= 

The characters in "source" from "start" through "end" are 
scanned for charactertsl in "delimiter". If the delimiter 
is not founo, "index" is set to the "end", plus j, , and a 
branch to the pc offset is executed. if a delimiter is 
found, "index" is set to the character position preceeoi no 
the start of the delimiter. s'siote if the delimiter contains 
more than one character, all the characters must occur in 
sequence in "source". 

memo no. 3i2 
^0/0ct/7 l 
page ?o 

1.5.R Miscellaneous (t>) 

* GO i 0 <po offset> 

This instruction causes replacement of the offset Dortion 
of the program counter oy "po offset". 

* r ’U_T0_0FFdET —pc — 

This instruction causes a branch to be t a k e n to the pc 
offset . 

The following two instructions are generated as a compli- 
mentary pair. jhe "ending adoress variable" is the same in 
both instructions. 

* Pt.RFOKM_THRu <ending address va r i ab 1 e > , -pc~ 

The address of the instruction following the pEr<FuRm_ I HkU 
is assigned to the enuino address variable; then a oranch 
is executed to the pc offset. 

* Ei\in_PLRFOKM <enoing address vari abl e> 

The current value of the ending address variable is 
fetched. The address of the instruction following the 
END_Pt.Rr ORM is stored in the endi na adoress variaole. A 
branch to the fetched ending address completes the execu- 
tion of this instruction. I he compiler must ensure that 
the initial value of the ending address variable is the 
address of the instruction following the tNd_PEh,FuRM . 

* CaLL <.procedure> 

This instruction invokes the common external call 

mechanism^ with no parameters. 

* CALI USING =n = , <p r ocedu re> ; <Pa r ame t e r- 1 > ... <paramet er-n> 

This instruction invokes the common externa] call 

mechanism; with "n" parameters. 

Memo no. 3x2 
20/0c t / 7 / 
page 2 <4 

Appendix- bPL description of EDI T_ nUmEkIl 

procedure edit_numeric (read on i y s: 

write only t: 
reao only p : 

a I pn anume r i c , 
d i c c u re ) i 

type picture is array fp i c t u r e_coun t e rl of oyte; 
picture_counter is 0..35; 

alphanumeric is array 1 1 a rge t_coun t e rl of byte; 
t arget_counter is 1..3u; 

numeric is any of the seven decimal dwarves; 
source.counter is 1..16? 

byte is bit d as 0 . . 2 5 b ; 

variable finished: 
t r i qge rea : 

boo lean; 
bool ean ; 
bool ean; 

di gi t_suDSt i tute: byte; 

negat i ve_i nser t : byte; 

posi t i ve_i nsert : byte; 

si: sou rc e.coun t e r ; 

ti: target_counter; 

pi: p i c t u r e„coun t e r ; 

Memo no. 3x2 
20/ 0ct/7/ 
page 2t> 

function deri ve_opcode tread only pixel: oytej 
returns edit.opcooe; 

type edit.opcode is ( mo ve.nume r i c , 

move .numeric. suppressed* 

mnvp_numenc_f loatiny, 

insert .character, 

insert .character. suppressed* 

i nsert_s i gn* 

end_ f 1 oat i no, 

t)l ank_when_zeroi 

ena.edi t * 


set.flaatina.insertsj ? 

beg i n 

select pixel<u:4> of 

case 1: return move_numeric; 

case 2../: return insert .character; 

case 8: return mo ve.nume r i c.supp ressea ? 

case 9 : return move. numer i c.f I oat i ng? 

case 10. .15: return i nse r t .c n a r ac t e r.supp r esseu ? 

case 0: select p i x e 1 < 4 : 4 > of 

case 0: return set.suppress i on * 
case 1: return set.floating. inserts? 
case 2: return end.f 1 oat i ng? 

case 3: return insert.sign; 
case 4: return b 1* 

case S: return end.edit? 

otherwise: nothing; 

end select? 

end select? 

end function der i ve.opcode ? 

demo no. 3 i 2 
^O/Oct/7 i 
page ?. o 

procedure exec_pixei 


on | y 

pixel : 





t r i ggereo: 

doo 1 ean , 


on | y 

neyat i ve ; 

ooo lean. 




doo lean. 



di gi t_ sub st i tute: 








pos i t i ve_i nse r t : 


variaDle cc: 
sc : 
z : 

bv t e ; 
bool ean ; 

7 . working character 
7 . scratch character 
% is source digit zero.' 


select der i ve_ opcode (p i xe 1 ) of 

case move_numeric: 

times pixe1<^:^> repeat 

get_ai gi t_f rom_source (cc» z); 
triggered := triggered or not z? 
put_character_into_target (cc); 

end times; 

case move_numeri c_ suppressed: 

times pi xel <4:4> repeat 

get_ui gi t_f rom_source (cc, z); 
if z and not triggered 

then cc := di gi t_suDSt i tute; 
end if; 

triggered := triggered or not z! 
put_character_i nto„target (cc); 

end times; 

Memo no. 3l2 
page ?/ 

case nove_numeric_f loating: 

times nixel<4:4> repeat 

get_di gi t_f rom. source (ccr z); 
if not t r i gqe r ed 

then if z then cc := di gi t_suost i tutei 
else if negat 1 ve 

then sc := negat i ve_i nsert * 
else sc := pos i t i ve„i nsert ? 
end 1 f ; 

pu t_c Ha r ac t e r_ i n t o_t arget (sc); 

ena if; 

end if; 

triggered := triggered or not &} 
put_character_i nto_target (cc); 

end times; 

case insert_ char; 

cc ;= pi xel <1 ;7>; 

put _c ha r ac t e r_i n t o_t a roe t (cc); 

case i nsert_char_suPpr , esseo: 

if t r i qgered 

then cc := pi xel <1 ;7>; 
else cc ;= diai t_subst i tute? 
end if? 

du t _c na rac t e r_i n t o_t a rget (cc) ; 

case insert_sign; 

qet_nex t_pi xe 1 (sc); 

get_next_pi xe I (cc); 
if negative then cc := sc; end if; 
put_cnaracter_i nto_target (cc); 

Memo no. 3l2 
20/0ct /ll 
page ?o 

case end _d rifting: 

if t r i ggered 

then nothinq; 
else if negat i ve 

then cc := neqat i ve_i nse r t ; 
else cc := pos i t 1 ve_i nsert ; 
end if* 

nut_character_i nto_tarqet (cc); 

end if; 

case b 1 ank_when_z e ro : 

if not triggered then bl ank_target J end if; 
finished := true; 

case end_ed i t : 

finished : = true; 

case set _supp ress i on ; 

pet_next_pixel (digit ..substitute). 

case set _floatmg_ insertions: 

get _n ext ..pixel (negative., insertion), 
oet..next_pi xel (positive.. insertion); 

end select; 


end procedure exec_pixe! 

Memo no. 3x2 
d<VOc t / 7 / 
page 29 

begi n 











finished := false; 
negative := i s_negat i ve t s ) ; 
t r i gaered ; = false; 

di pi t_ suhst i tute : = asc 1 I_space; 
negat i ve_i nsert i on ;= A$c i I_m i nus ; 
pos i t i ve_i nsert i on := ASCII_space; 

si ; = 1 ; 

t i : = 1 ; 
pi : = 0 ; 

get _nex t_pi xel (target _aigitsj; 

get_next_pi xel (ccj; 
ex ec_p i xe 1 ( cc ) ; 

if finished then return; end if; 
end repeat; 

end procedure edi t_numer i c ;